home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
dtk_demo.zip
/
TIMER.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-12
|
772b
|
39 lines
/* TIMER.C
* last mod.: 21-AUG-91
*/
#include <STDIO.H>
#include <STDLIB.H>
#include <CONIO.H>
#include <L_TIME.H>
/*-----------*/
void main(void)
{
int ticks, ch;
printf("This program times keypresses. "
"Time in seconds or clock ticks? (S/T) ");
while ( ch != 'S' && ch != 'T' )
{
ch = getch();
ch -= 32*(ch>'Z');
}
printf("%c\nPress 'X' to exit, "
"any other key to time keypresses.\n",ch);
ticks = ( ch == 'T' );
time_elapsed(0); /* initialize */
while ( ch = getch() )
{
ch -= 32*(ch>'Z');
if ( ch == 'X' )
exit(0);
if ( ticks )
printf("Ticks elapsed = %lu\n",time_elapsed(1));
else
printf("Seconds elapsed = %lu\n",time_elapsed(2));
}
}